#!/usr/bin/env python
PACKAGE = "roboteq_control"

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

#from 250
# to check ALIN - analog linearity [pag. 288]

# AMOD [pag. 292]
conversion_type = gen.enum([ gen.const("conversion_disabled",          int_t, 0, "Disable conversion type"),
                             gen.const("absolute", int_t, 1, "Enable in absolute mode"),
                             gen.const("relative", int_t, 2, "Enable in relative mode"),],
                            "Type of analog input conversion")
gen.add("conversion", int_t, 0, "Type of analog input conversion", 0, 0, 2, edit_method=conversion_type)

# AINA [pag. 287]
input_use_type = gen.enum([ gen.const("input_disabled",  int_t, 0, "Disabled"),
		         gen.const("motor_command",  int_t, 1, "Motor command"),
                         gen.const("feedback", int_t, 2, "Feedback")],
                         "configuration")
gen.add("input_use", int_t, 0, "Configuration analog input", 0, 0, 2, edit_method=input_use_type)
motor_enable = gen.enum([ gen.const("disabled",  int_t, 0, "Disabled"),
		         gen.const("enabled",  int_t, 1, "enabled")],
                         "Enable feedback from this motor")
gen.add("input_motor_one", int_t, 0, "Configuration pulse input", 0, 0, 2, edit_method=motor_enable)
gen.add("input_motor_two", int_t, 0, "Configuration pulse input", 0, 0, 2, edit_method=motor_enable)

# APOL [pag. 293]
conversion_polarity = gen.enum([ gen.const("direct",  int_t, 0, "After gears"),
                    gen.const("inverse", int_t, 1, "Before gears")],
                    "Polarity conversion")
gen.add("conversion_polarity", int_t, 0, "Conversion analog input", 1, 0, 1, edit_method=conversion_polarity)

# ADB [pag. 286]
gen.add("input_deadband",  int_t, 0, "[%] How the movement near to zero is considered zero",   0,  0, 50)

# AMIN [pag. 290]
gen.add("range_input_min",  double_t, 0, "[V] Set the analog input min",   0.1,  0, 10)

# AMAX [pag. 289]
gen.add("range_input_max",  double_t, 0, "[V] Set the analog input max",   4.9,  0, 10)

# ATCR [pag. 285]
gen.add("range_input_center",  double_t, 0, "[V] Set the analog input center",   2.5,  0, 10)

#Default command
gen.add("load_roboteq", bool_t  , 0, "Load all parameters from Roboteq board", False)
gen.add("restore_defaults", bool_t  , 0, "Restore to the original configuration", False      )

exit(gen.generate(PACKAGE, "roboteq_node", "RoboteqAnalogInput"))
